grant_entry_t *sha;
struct gnttab_transfer gop;
unsigned long mfn;
+ unsigned int max_bitsize;
for ( i = 0; i < count; i++ )
{
if ( xsm_grant_transfer(d, e) )
{
+ gop.status = GNTST_permission_denied;
unlock_and_copyback:
rcu_unlock_domain(e);
page->count_info &= ~(PGC_count_mask|PGC_allocated);
free_domheap_page(page);
- gop.status = GNTST_permission_denied;
goto copyback;
}
- if ( (1UL << domain_clamp_alloc_bitsize(e, BITS_PER_LONG-1)) <= mfn )
+ max_bitsize = domain_clamp_alloc_bitsize(
+ e, BITS_PER_LONG+PAGE_SHIFT-1);
+ if ( (1UL << (max_bitsize - PAGE_SHIFT)) <= mfn )
{
struct page_info *new_page;
void *sp, *dp;
- new_page = alloc_domheap_pages(
- NULL, 0,
- MEMF_bits(domain_clamp_alloc_bitsize(e, BITS_PER_LONG-1)));
+ new_page = alloc_domheap_pages(NULL, 0, MEMF_bits(max_bitsize));
if ( new_page == NULL )
+ {
+ gop.status = GNTST_address_too_big;
goto unlock_and_copyback;
+ }
sp = map_domain_page(mfn);
dp = map_domain_page(page_to_mfn(new_page));
d = current->domain;
memflags |= MEMF_bits(domain_clamp_alloc_bitsize(
- d, exch.out.address_bits ? : BITS_PER_LONG));
+ d, exch.out.address_bits ? : (BITS_PER_LONG+PAGE_SHIFT)));
cpu = select_local_cpu(d);
ASSERT(!in_irq());
- bits = domain_clamp_alloc_bitsize(d, bits ? : BITS_PER_LONG);
+ bits = domain_clamp_alloc_bitsize(d, bits ? : (BITS_PER_LONG+PAGE_SHIFT));
if ( bits <= (PAGE_SHIFT + 1) )
return NULL;
#define GNTST_no_device_space (-7) /* Out of space in I/O MMU. */
#define GNTST_permission_denied (-8) /* Not enough privilege for operation. */
#define GNTST_bad_page (-9) /* Specified page was invalid for op. */
-#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary */
+#define GNTST_bad_copy_arg (-10) /* copy arguments cross page boundary. */
+#define GNTST_address_too_big (-11) /* transfer page address too large. */
#define GNTTABOP_error_msgs { \
"okay", \
"no spare translation slot in the I/O MMU", \
"permission denied", \
"bad page", \
- "copy arguments cross page boundary" \
+ "copy arguments cross page boundary", \
+ "page address size too large" \
}
#endif /* __XEN_PUBLIC_GRANT_TABLE_H__ */